package cn.seecoder.ai.model.vo;

import cn.seecoder.ai.enums.MachineLearningAlgorithmEnum;
import cn.seecoder.ai.enums.TrainParamEnum;
import cn.seecoder.ai.enums.TrainingStateEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.Map;

/**
 * @author fanyanpeng
 * @date 2023/4/11 23:09
 */
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Data
public class ModelVO {

    private Integer id;

    @NotNull(message = "模型需指定配置id")
    private Integer configId;

    @NotNull(message = "模型需指定创建者id")
    private Integer userId;

    @NotEmpty(message = "模型命名不为空")
    private String modelName;

    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @NotNull(message = "机器学习算法不为空")
    private MachineLearningAlgorithmEnum machineLearningAlgorithm;

    private Map<TrainParamEnum,Object> trainParams;

    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private TrainingStateEnum trainingState;

    private Map<String,Object> trainResults;
    
    private String modelUri;

    private String featuresIndexerUri;

    private String labelIndexerUri;

    private Double accuracy;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
    private Date trainingStartTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
    private Date trainingFinishTime;

    private Date createdTime;

    @ApiModelProperty("文件名")
    private String fileInfoName;

    @ApiModelProperty("配置名称")
    private String configName;

    private String username;





    public Date getCreatedTime() {
        return createdTime;
    }

    public ModelVO setCreatedTime(Date createdTime) {
        this.createdTime = createdTime;
        return this;
    }

    public String getFileInfoName() {
        return fileInfoName;
    }

    public ModelVO setFileInfoName(String fileInfoName) {
        this.fileInfoName = fileInfoName;
        return this;
    }

    public String getConfigName() {
        return configName;
    }

    public ModelVO setConfigName(String configName) {
        this.configName = configName;
        return this;
    }

    public Date getTrainingStartTime() {
        return trainingStartTime;
    }

    public ModelVO setTrainingStartTime(Date trainingStartTime) {
        this.trainingStartTime = trainingStartTime;
        return this;
    }

    public Date getTrainingFinishTime() {
        return trainingFinishTime;
    }

    public ModelVO setTrainingFinishTime(Date trainingFinishTime) {
        this.trainingFinishTime = trainingFinishTime;
        return this;
    }

    public Integer getId() {
        return id;
    }

    public ModelVO setId(Integer id) {
        this.id = id;
        return this;
    }

    public Integer getConfigId() {
        return configId;
    }

    public ModelVO setConfigId(Integer configId) {
        this.configId = configId;
        return this;
    }

    public Integer getUserId() {
        return userId;
    }

    public ModelVO setUserId(Integer userId) {
        this.userId = userId;
        return this;
    }

    public String getModelName() {
        return modelName;
    }

    public ModelVO setModelName(String modelName) {
        this.modelName = modelName;
        return this;
    }

    public MachineLearningAlgorithmEnum getMachineLearningAlgorithm() {
        return machineLearningAlgorithm;
    }

    public ModelVO setMachineLearningAlgorithm(MachineLearningAlgorithmEnum machineLearningAlgorithm) {
        this.machineLearningAlgorithm = machineLearningAlgorithm;
        return this;
    }

    public Map<TrainParamEnum, Object> getTrainParams() {
        return trainParams;
    }

    public ModelVO setTrainParams(Map<TrainParamEnum, Object> trainParams) {
        this.trainParams = trainParams;
        return this;
    }

    public TrainingStateEnum getTrainingState() {
        return trainingState;
    }

    public ModelVO setTrainingState(TrainingStateEnum trainingState) {
        this.trainingState = trainingState;
        return this;
    }

    public Map<String, Object> getTrainResults() {
        return trainResults;
    }

    public ModelVO setTrainResults(Map<String, Object> trainResults) {
        this.trainResults = trainResults;
        return this;
    }

    public String getModelUri() {
        return modelUri;
    }

    public ModelVO setModelUri(String modelUri) {
        this.modelUri = modelUri;
        return this;
    }

    public String getFeaturesIndexerUri() {
        return featuresIndexerUri;
    }

    public ModelVO setFeaturesIndexerUri(String featuresIndexerUri) {
        this.featuresIndexerUri = featuresIndexerUri;
        return this;
    }

    public String getLabelIndexerUri() {
        return labelIndexerUri;
    }

    public ModelVO setLabelIndexerUri(String labelIndexerUri) {
        this.labelIndexerUri = labelIndexerUri;
        return this;
    }
}
